Linux系统时间同步

本文介绍了如何在Linux系统中搭建时间同步服务器,并详细阐述了在需要同步时间的服务器上执行同步命令的过程,包括遇到的问题及解决方案,最后讨论了将时间同步设置为定时任务的方法。
摘要由CSDN通过智能技术生成

Linux系统时间同步

一、第一步:搭建用于时间同步的服务器

在一台时间比较准确的服务器上,启动ntpd服务,比如这台时间比较精确的服务ip为11.225.118.166

1.1 先安装npt模块:sudo yum -y install ntp

1.2 写配置文件/etc/npt.conf

sudo vi /etc/npt.conf

driftfile /var/lib/ntp/drift

restrict default nomodify notrap nopeer noquery

restrict 127.0.0.1

#  10.114.57.0 代表允许时间同步的服务器ip
restrict 10.114.57.0 mask 255.255.255.0 nomodify notrap
server 127.127.1.0

includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys

disable monitor
tinker panic 0

1.3 启动ntp服务

-- 查看状态
sudo systemctl status ntpd
-- 启动nptd
sudo systemctl start ntpd

二、第二步:在需要同步时间服务器上进行时间同步

该需要时间同步的服务ip应该以10.114.57开头。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值